import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    // 路由重定向
    redirect:'/home/index'
  },
  {
    path: '/home',
    name: 'home',
    component: HomeView,
    children:[{
      path:'index',
      component:() => import('../views/index/index.vue') 
    },{
      path:'consensus',
      component:() => import('../views/consensus/Consensus.vue') 
    },{
      path:'march',
      component:() => import('../views/march/March.vue') 
    },{
      path:'fourth',
      component:() => import('../views/fourth/fourth.vue') 
    },
  ],
  },
  {
    path:'/indexbar',
    component:() => import('../views/index/indexBar.vue') 
  },
  {
    path:'/coach',
    component:() => import('../views/index/coach.vue') 
  },
  {
    path:'/cankao',
    component:() => import('../views/index/cankao.vue') 
  },
  {
    path:'/onsearch',
    component:() => import('../views/index/search.vue') 
  },
  {
    path:'/footer',
    component:() => import('../views/index/food.vue') 
  },
  {
    path:'/city',
    component:() => import('../views/index/city.vue') 
  },
  {
    path:'/hotel',
    component:() => import('../views/index/hotel.vue') 
  },
  {
    path:'/dis',
    component:() => import('../views/index/dis.vue') 
  },
  {
    path:'/camp',
    component:() => import('../views/index/camping.vue') 
  },
  {
    path:'/bepaid',
    component:() => import('../views/fourth/bepaid.vue') 
  },
  {
    path:'/weiyou',
    component:() => import('../views/index/WeYoo.vue') 
  },
  {
    path:'/foodlist',
    component:() => import('../views/index/FoodList.vue') 
  },
  {
    path:'/citylist',
    component:() => import('../views/index/CityList.vue') 
  },
  {
    path:'/hotelist',
    component:() => import('../views/index/HotelList.vue') 
  },
  {
    path:'/list',
    component:() => import('../views/index/List.vue') 
  },
  {
    path:'/login',
    component:() => import('../views/user/Login.vue') 
  },
  {
    path:'/map',
    component:() => import('../views/consensus/Amap.vue') 
  },
  {
    path:'/gouwu',
    component:() => import('../views/consensus/Gouwuche.vue') 
  },
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

// router.beforeEach((to, from, next) => {
//   console.log(to);
// });

export default router
